package test.hystrix.client;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

import com.netflix.config.ConfigurationManager;
import com.netflix.hystrix.HystrixCircuitBreaker;
import com.netflix.hystrix.HystrixCommandKey;
import com.netflix.hystrix.HystrixRequestCache;
import com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategyDefault;
import com.netflix.hystrix.strategy.concurrency.HystrixRequestContext;

public class RunClient {
		
	public static void main(String[] args) throws InterruptedException, ExecutionException {
		
		ConfigurationManager.getConfigInstance().setProperty("hystrix.collapser.default.timerDelayInMilliseconds", 1000);
		HystrixRequestContext context = HystrixRequestContext.initializeContext();
		MyHystrixCollapser cl = new MyHystrixCollapser("aaa") ; 
		MyHystrixCollapser c2 = new MyHystrixCollapser("aaa") ; 
		Future<String> fl=  cl.queue(); 
		Future<String> f2 = c2.queue(); 
		System.out.println(fl.get()); 
		System.out.println(f2.get()); 
		context.shutdown() ;
	}
}
